
import axios from 'axios';

const HomeMudule = {
    state:{
        lunbodata:[],
        fourdata:[],
        threedata:[],
        renqidata:[],
        jiajuchengdata:[],
        jianchaidata:[],
    },
    mutations:{
        setLunbo(state,value){
            state.lunbodata = value;
        },
        setFour(state,value){
            state.fourdata = value;
        },
        setThree(state,value){
            state.threedata = value;
        },
        setRenqi(state,value){
            state.renqidata = value;
        },
        setJiajucheng(state,value){
            state.jiajuchengdata = value;
        },
        setJianchai(state,value){
            state.jianchaidata = value;
        },
    },
    actions:{
        requestlunbo(state){
            axios.get("/api/lunbo")
            .then(res=>{
                state.commit("setLunbo",res.data.data);
            });
        },
        requestfour(state){
            axios.get("/api/four")
            .then(res=>{
                state.commit("setFour",res.data.data);
            });
        },
        requestthree(state){
            axios.get("/api/three")
            .then(res=>{
                state.commit("setThree",res.data.data);
            });
        },
        requestrenqi(state){
            axios.get("/api/renqi")
            .then(res=>{
                 state.commit("setRenqi",res.data.data);
            });
        },
        requestjiajucheng(state){
            axios.get("/api/jiajucheng")
            .then(res=>{
                state.commit("setJiajucheng",res.data.data);
            });
        },
        requestjianchai(state){
            axios.get("/api/jianchai")
            .then(res=>{
               state.commit("setJianchai",res.data.data);
            });
        },
    },
}

export default HomeMudule;

